
<html>

	<head>
            <link rel="stylesheet" type="text/css" href="scripts/prueba.css"/>
	</head>

	<body>
		<div class="pcpal">
                <div class="menu">
                <?php
                    require_once("scripts/Menu.php");
                ?>
                </div>
                <div class="content1">
                    <img src="/AppResiduos2/images/3065152.jpg" alt="energia" style="width: 800px; height: 330px;" align="middle">
                </div>
                <div class="content2">
                <?php

                require_once("/var/www/AppResiduos2/lib/dao/EmpresaDAO.php");
                require_once("/var/www/AppResiduos2/lib/dao/TransportadorResiduoDAO.php");

                $eDAO = new EmpresaDAO();
                $e = $eDAO->listarTransportadores();
                session_start();
		$privil = $_SESSION['priv'];

                $rDAO = new ResiduoDAO();

                $trDAO = new TransportadorResiduoDAO();

                ?>

                <table id="others" border="1">
                                <tr class="alt2">
					<td> Id </td>
					<td> Transporter's name </td>
                                        <td> Residues Transported <br> (residue:producer)</td>
                                        <td></td>
                                        <td></td>
				</tr>
		<?php
                                        $i = 0;
					while ($i < sizeof($e))
					{

                ?>				<tr class="alt2">
							<td> <?php print_r($e[$i]->id); ?> </td>
							<td> <?php print_r($e[$i]->name); ?> </td>
                                                        <td> <?php
                                                                $tr = $trDAO->listarResiduoProdTransp($e[$i]->id);
                                                                print_r(implode(",", $tr));
                                                             ?>
                                                        </td>
                                                        
		<?php

						if ($privil == 1)
						{

                ?>
							<td> <form method=post action="AdministrarEmpresa.php">
								<input type="hidden" name="name_org" value="<?php print_r($e[$i]->name); ?>">
								<input type="submit" name="modifyOrg" value="Modify"> </form> </td>
							<td> <form method=post action="AdministrarEmpresa.php">
								<input type="hidden" name="name_org" value="<?php print_r($e[$i]->name); ?>">
								<input type="submit" name="deleteOrg" value="Delete"> </form> </td>

		<?php
						}
                                                $i = $i + 1;
		?>

						</tr>
		<?php
					}
					if ($privil == 1){

		?>
						<tr class="alt2">
                                                    <td colspan=3></td>
                                                    <td colspan=1> <form method=post action="AdministrarEmpresa.php"> <input type="submit" name="newOrg" value="New"> </form> </td>
                                                    <td></td>
						</tr>
		<?php
					}
		?>
		</table>
                </div>
		</div>
	</body>



</html>

